<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link rel="stylesheet" th:href="@{/layui/css/layui.css}"  media="all">
    <script th:src="@{/layui/layui.js}" charset="utf-8"></script>
</head>
<body>



<form class="layui-form" action="" id="form1">
    <br>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">用户编码</label>
            <div class="layui-input-inline">
                <input type="hidden" name="id" required="required" th:value="${userm.id} " class="layui-input">
                <input type="text" name="usercode"  th:value="${userm.usercode} "  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">用户名字</label>
            <div class="layui-input-inline">
                <input type="text" name="username" required="required" th:value="${userm.username}"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-inline">
                <input type="tel" name="userPassword" th:value="${userm.userPassword}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">年龄</label>
            <div class="layui-input-inline">
                <input type="tel" name="gender" th:value="${userm.gender}" autocomplete="off" class="layui-input">
            </div>
        </div>
       <!-- <div class="layui-inline">
            <label class="layui-form-label">生日</label>
            <div class="layui-input-inline">
                <input type="text" name="birthday" th:value="${userm.birthday}" id="date"  placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
            </div>
        </div>-->
        <div class="layui-inline">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-inline">
                <input type="text" name="phone" required="required" th:value="${userm.phone}"  autocomplete="off" class="layui-input">
            </div>
        </div>


    </div>

    <div class="layui-form-item">

        <div class="layui-inline">
            <label class="layui-form-label">地址</label>
            <div class="layui-input-inline">
                <input type="text" name="address" th:value="${userm.address}"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">创建时间</label>
            <div class="layui-input-inline">
                <input type="text" name="creationDate" th:value="${userm.creationDate}" id="date1"  placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
            </div>
        </div>



    </div>


</form>
<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="submit" onclick="doSave()" class="layui-btn" >立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</div>

<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<script th:inline="javascript">

    var $,layer;
    layui.use(['form','laydate'],function (){

       var laydate = layui.laydate;
       $=layui.jquery;
       layer=layui.layer;

        //日期
        laydate.render({
            elem: '#date1'
        });
        laydate.render({
            elem: '#date'
        });



    })

    function doSave() {
       var requestData = $("#form1").serialize();

        $.post("/userm/save1",requestData,function (responseData) {
            if(responseData.success == 1){
               parent.layer.alert("更新用户成功",{yes:function () {
                       parent.layer.closeAll();
                   }
               });
            }else {
                parent.layer.alert("更新用户失败",{yes:function () {
                        parent.layer.closeAll();
                        window.parent.location.reload();
                    }
                });

            }



            
        });
    }

</script>

</body>
</html>